 /*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

{{! Select all the comment items and expand them here }}
{{#.}}
{{#comment}}
{{comment}}
{{/comment}}
{{/.}}

#include "presto_cpp/presto_protocol/core/presto_protocol_core.h"
#include "presto_cpp/main/thrift/gen-cpp2/presto_thrift_types.h"

namespace facebook::presto::thrift {

void toThrift(const facebook::presto::protocol::Duration& duration, double& thrift);
void toThrift(const facebook::presto::protocol::DataSize& dataSize, double& thrift);
void fromThrift(const double& thrift, facebook::presto::protocol::Duration& duration);
void fromThrift(const double& thrift, facebook::presto::protocol::DataSize& dataSize);

{{! Select all the items and expand either the "hinc" member or the "struct", "enum" members }}
{{#.}}
{{#hinc}}
{{&hinc}}
{{/hinc}}
{{^hinc}}
{{#connector}}
void toThrift(const std::shared_ptr<facebook::presto::protocol::{{class_name}}>& proto, {{class_name}}& thrift);
void fromThrift(const {{class_name}}& thrift, std::shared_ptr<facebook::presto::protocol::{{class_name}}>& proto);

{{/connector}}
{{#union}}
void toThrift(
    const std::shared_ptr<facebook::presto::protocol::{{proto_name}}>& proto,
    apache::thrift::optional_field_ref<{{class_name}}&> thrift);
void toThrift(
    const std::shared_ptr<facebook::presto::protocol::{{proto_name}}>& proto,
    {{class_name}}& thrift);
void fromThrift(
    apache::thrift::optional_field_ref<const {{class_name}}&> thrift,
    std::shared_ptr<facebook::presto::protocol::{{proto_name}}>& proto);
void fromThrift(
    const {{class_name}}& thrift,
    std::shared_ptr<facebook::presto::protocol::{{proto_name}}>& proto);
{{/union}}
{{#struct}}
void toThrift(const facebook::presto::protocol::{{class_name}}& proto, {{&class_name}}& thrift);
void fromThrift(const {{&class_name}}& thrift, facebook::presto::protocol::{{#proto_name}}{{proto_name}}{{/proto_name}}{{^proto_name}}{{class_name}}{{/proto_name}}& proto);

{{/struct}}
{{#wrapper}}
void toThrift(const facebook::presto::protocol::{{class_name}}& proto, {{class_name}}& thrift);
void fromThrift(const {{class_name}}& thrift, facebook::presto::protocol::{{class_name}}& proto);

{{/wrapper}}
{{#enum}}
void toThrift(const facebook::presto::protocol::{{class_name}}& proto, {{class_name}}& thrift);
void fromThrift(const {{class_name}}& thrift, facebook::presto::protocol::{{class_name}}& proto);

{{/enum}}
{{/hinc}}
{{/.}}

} // namespace facebook::presto
